const {
	Service
} = require('uni-cloud-router')
const {empty , typeOf} = require('../methods/index.js')

module.exports = class centerService extends Service {
	constructor(ctx) {
		super(ctx)
		this.dbCmd = this.db.command
		this.userSchedule = this.db.collection('hr-userSchedule')
		this.enumConverter = ["上学期","下学期"]
	}
	
	// 获取搜索项
	async searchOption(username){
		return this.userSchedule.where({username}).get().then((res)=>{
			let list = []
			return list = res.data.map((item)=>{
				let {_id , year , term} = item
				 return { value: _id, label: `${year}年-${this.enumConverter[term]}` };
			})
		})
	}
}